﻿using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using LINQtoFxCop.Core;

namespace LINQtoFxCop.Metrics.Methods
{
  public class MethodNbParameters : MetricsIntrospectionRule
  {
    protected MethodNbParameters(string name, string resourceName, Assembly assembly)
      : base(name, resourceName, assembly)
    { }
    public MethodNbParameters()
      : base("MethodNbParameters")
    { }

    protected override IEnumerable<QueryResult> Query()
    {
      return
        from method in Methods
        where method.NbParameters() > MetricThreshold()
        select Result(method, method.NbParameters());
    }
  }
}